package com.dzsw.javabase.collection;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class NonChangeCollection {

    public static void main(String[] args) {
        List<String> charList = List.of("a", "b", "c", "d", "e", "f", "g", "h");
        System.out.println(charList.stream().collect(Collectors.joining(",")));

        Set<Integer> numberList = Set.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
        System.out.println(numberList.stream().collect(Collectors.groupingBy(e -> e % 2 == 0)));

        Map<String, Integer> scoreMap = Map.of("laoda", 100, "laoer", 80, "laosan", 95);
        System.out.println(scoreMap.entrySet().stream().collect(Collectors.groupingBy(e -> e.getValue())));

        scoreMap = Map.ofEntries(
                Map.entry("laoda", 100),
                Map.entry("laoer", 80),
                Map.entry("laosan", 80)
        );
        System.out.println(scoreMap.entrySet().stream().collect(Collectors.groupingBy(e -> e.getValue())));
    }
}
